package semantic.parser;

import java.util.Objects;

public abstract class SymbolTableElement {
    private final int address;
    private final SymbolType type;
    private final String ident;


    public SymbolTableElement(int address, SymbolType type, String ident) {
        this.address = address;
        this.type = type;
        this.ident = ident;
    }


    public enum SymbolType {
        CONST_INT,
        INT,
        VOID_FUNC,
        INT_FUNC
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SymbolTableElement element = (SymbolTableElement) o;
        return Objects.equals(ident, element.ident);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ident);
    }


    public final SymbolType getType() {
        return type;
    }

    public String getIdent() {
        return ident;
    }
}
